import React,{useState,useEffect,useReducer} from "react";
const reduce =(state, action)=> {
    if(action ==="+"){
        return state+1;
    }
    if(action ==="-"){
        return state-1;
    }
}
function Reducer(){
    // const [count ,setCount] = useState(0);
    
    const [count,display] = useReducer(reduce,0)

    return (
        <div >Reducer{count}

        <button onClick={()=>display("+")}>+</button>
        <button onClick={()=>display("-")}>-</button>
        </div>

    )
}
export default Reducer;